package com.cb.controller;

import com.cb.service.ConductorVipService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.util.HashMap;

@RestController
@RequestMapping("/conductor/vip")
public class ConductorVipController {

    @Autowired
    private ConductorVipService conductorVipService;

    Logger logger = LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);

    //查询影院内全部会员(yyid)
    @PostMapping("/getAllVip")
    public String getAllVip(@RequestBody HashMap map) {
        return conductorVipService.getAllVipList(map);
    }

    //分类查询影院内会员(code:0:到期，1:未到期,yyid)
    @PostMapping("/chooseVip")
    public String chooseVip(@RequestBody HashMap map) {
        return conductorVipService.getVip(map);
    }

    //搜索查询影院内会员(username,yyid)
    @PostMapping("/searchVip")
    public String searchVip(@RequestBody HashMap map){
        return conductorVipService.searchVip(map);
    }

    //办理会员(影院编号：yyid,用户账号：username,开通月份：i)
    @PostMapping("/insert")
    public int insert(@RequestBody HashMap map) throws ParseException {
        return conductorVipService.vipInsert(map);
    }

}
